<!-- eslint-disable prettier/prettier -->
<!-- eslint-disable @typescript-eslint/explicit-function-return-type -->
<script lang="ts" setup>
import { useUserStore } from '@renderer/store/user'
import { storeToRefs } from 'pinia'

// store对象
const userStore = useUserStore()

// 获取store暴露数据
const { count } = storeToRefs(userStore)

// 加
const jiaCount = () => {
  userStore.count += 1
}

// 减
const jianCount = () => {
  userStore.count -= 1
}

// 打开新窗口
const open = (): void =>
  window.electron.ipcRenderer.send('open-window', {
    path: '/detail?id=3333',
    width: 700,
    height: 610
  })
</script>

<template>
  <div>
    <div>列表</div>
    <div>{{ count }}</div>
    <div @click="jiaCount">加1</div>
    <div @click="jianCount">减1</div>
    <div @click="open">打开详情</div>
  </div>
</template>
